package com.gitee.form_token.entity;

import com.gitee.form_token.common.LocalDateTimeSerializer;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 用户表
 * </p>
 *
 * @author Saturn
 * @since 2024-11-01
 */
@Data
@TableName("app_user")
public class AppUser implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @TableField("username")
    private String username;

    @TableField("password")
    private String password;

    @TableField("tel")
    private String tel;

    @TableField("avatar")
    private String avatar;

    // 方式一
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("last_login")
    private LocalDateTime lastLogin;

    // 方式二
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @TableField("created")
    private LocalDateTime created;

    @TableField("updated")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    private LocalDateTime updated;

    @TableField("deleted")
    private Integer deleted;

}
